from alg import Solution
from gen import test_data

solution = Solution()


def integer_replacement_main():
    data = test_data['integer_replacement']
    print("n:              {}".format(data))
    print("Minimum degree: {}\n".format(solution.integer_replacement(data)))


def solve_n_queens_main():
    data = test_data['solve_N_queens']
    data = 6
    print("nums:           {}".format(data))
    print("queens:         {}\n".format(solution.solve_n_queens(data)))


def max_sub_array_main():
    data = test_data['max_sub_array']
    print("list:           {}".format(data))
    print("max sum:        {}".format(solution.max_sub_array(data)))

def cat_max_number():
    nums1,nums2,k = test_data['splicing_maximum']
    print("nums1:              {}".format(nums1))
    print("nums2:              {}".format(nums2))
    print("k:                  {}".format(k))
    print("The max_nums is: {}\n".format(solution.maxNumber(nums1,nums2,k)))
    

# def first_missing_positive_main():
#     data = test_data['first_missing_positive']
#     print("nums:   {}".format(data))
#     print("Minimun missing positive: {}".format(solution.first_missing_positive(data)))
def permute_main():
    # data = test_data['permute']
    # print("nums:   {}".format(data))
    # print("All permutations: {}".format(solution.permute(data)))
    print("nums:   {}".format([1]))
    print("All permutations: {}".format(solution.permute([1])))

def binaryTreePaths_main():
    root = test_data['binaryTreePaths']
    print("root:   {}".format(root))
    print("All paths: {}".format(solution.binaryTreePaths(root)))


def smallestSubsequence_main():
    print(*test_data['smallestSubsequence'])
    s = solution.smallestSubsequence(*test_data['smallestSubsequence'])
    print(s)


def first_missing_positive_main():
    data = test_data['first_missing_positive']
    print("nums:   {}".format(data))
    print("Minimun missing positive: {}".format(solution.first_missing_positive(data)))


def maxProfit_main():
    print(test_data['maxProfit'])
    s = solution.maxProfit(test_data['maxProfit'])
    print(s)

def pathWithObstacles_main():
    print(test_data['pathWithObstacles'])
    s = solution.pathWithObstacles(test_data['pathWithObstacles'])
    print(s)

# 分治
def bin_main():
    data_res = test_data['bin']
    rever_bin = solution.hammingWeight(data_res)
    print('输入:', data_res)
    print('输出:', rever_bin)
# 分发糖果
def candy_main():
    data_ratings = test_data['ratings']
    result = solution.candy(data_ratings)
    print('每个孩子的评分:', data_ratings)
    print('至少需要的糖果数:', result)

# 组合总和
def sum_list_main():
    data_candidates = test_data['candidates']
    data_tagert = test_data['target']
    sum_list = solution.combinationSum(data_candidates,data_tagert)
    print('candidates:', data_candidates)
    print('target', data_tagert)
    print('sum_list:', sum_list)



if __name__ == '__main__':
    smallestSubsequence_main()
    maxProfit_main()
    pathWithObstacles_main()
    integer_replacement_main()
    first_missing_positive_main()

    # integer_replacement_main()
    solve_n_queens_main()
    # max_sub_array_main()
    # cat_max_number()
    # permute_main()
    binaryTreePaths_main()
    smallestSubsequence_main()
    maxProfit_main()
    pathWithObstacles_main()
    bin_main()
    candy_main()
    sum_list_main()
